<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="./../include/stdlib.jspf" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@include file="include/meta.jspf" %>
    <title>故障工单编辑</title>
    <link rel="stylesheet" href="${root}/static/wechat/css.css">
    <link rel="stylesheet" href="${root}/static/wechat/index.css">
</head>
<body style="background-color: #fff">
<a type="button" style="float: right;margin-top: 15px; margin-right: 15px"
   href="wechat/billboardMalfunction">返回</a><br>
<h3 style="margin-left: 10px; margin-top: 10px">选择任务结果类型并填写处理结果</h3><br>
<div class="feeback_ct">
    <form id="result">
        <input type="hidden" id="id" name="id" value="${entity.id}">
        <label name="resultType" value="NORMAL" for="id1" class="feeback_ct_cl"
               style="padding-left: 25%;font-size: 20px" required="required">正常</label>
        <input style="display: none" id="id1" type="radio" name="resultType" value="NORMAL">
        <label name="resultType" value="REINFORCE" for="id2" class="feeback_ct_cl"
               style="padding-left: 25%;font-size: 20px" required="required">加固</label>
        <input style="display: none" id="id2" type="radio" name="resultType" value="REINFORCE">
        <textarea placeholder="请填写处理结果" id="resultDescription" name="resultDescription" required="required"></textarea>
    </form>
</div>
<div style="width: 50%;margin: 15px 25% 10px 25%">
    <p id="p1" style="display: none; color: red">*请确保两项操作都已完成</p>
</div>
<div class="poster_but_o">
    <input type="button" value="提交">
</div>
</body>
<%@include file="include/script.jspf" %>
<script type="text/javascript">
    $(function () {
        $('.feeback_ct_cl').click(function () {
            $(this).toggleClass("ct_click");
            $('.feeback_ct_cl').not($(this)).removeClass("ct_click")
        });
    });
</script>
<script type="application/javascript">
    $(".poster_but_o input").click(function () {
        if ($('input:radio[name="resultType"]:checked').val() == null || $('#resultDescription').val().trim().length == 0) {
            $('#p1').show();
            return false;
        } else {
            var id, resultType, resultDescription;
            id = $('#id').val();
            resultType = $('input[name="resultType"]:checked ').val();
            resultDescription = $('#resultDescription').val();
            request.post("resources/billboardMalfunction/save/result", {
                id: id,
                resultType: resultType,
                resultDescription: resultDescription
            }, function (data) {
                console.log(data);
                location.href = "${root}/wechat/billboardMalfunction";
            }, function (data) {
                console.log(data);
            });
        }
    });
</script>
</html>
